package com.woniuxy.commons.service;

import com.woniuxy.commons.entity.ResponseEntity;
import com.woniuxy.commons.entity.Vedio;
import com.woniuxy.commons.entity.VideoRemark;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Auther: 牟强
 * @Date: 2020/7/25/025 14:33
 * @Description: 上传试卷
 */
@FeignClient(name = "CLASSTEACHER")
public interface RemoteUploadingService {
    //上传试卷，参数1：excel文件
    // 参数2：request
    // 参数3：试卷类型（作业，考试。。。）
    // 参数4：年级
    @PostMapping(value = "/uploadingTestPaper", consumes = "multipart/form-data")
    public ResponseEntity<Void> uploadingTestPaper(@RequestBody MultipartFile filee, @RequestParam("refreshToken") String refreshToken, @RequestParam("paperType") Integer paperType, @RequestParam("grade") String grade);

    /**
     * @Author: 李英勇
     * @Description: 按条件分页全文搜索视频
     * @DateTime: 2020/8/1 15:38
     * @Params: [content:查询条件, page:当前页码, limit:分页大小]
     * @Return com.woniuxy.commons.entity.ResponseEntity<java.util.List < com.woniuxy.commons.entity.Vedio>>
     */
    @GetMapping("/findByContent/{content}")
    public ResponseEntity<List<Vedio>> findByContentLike(@PathVariable("content") String content, @RequestParam("page") int page, @RequestParam("limit") int limit);

    /**
    * @Author: 李英勇
    * @Description: 视频上传
    * @DateTime: 2020/8/3 10:12
    * @Params: [knowledge：知识点， open：公开等级：0全市，1全校，2本班, content：描述, file：视频文件, refreshToken]
    * @Return com.woniuxy.commons.entity.ResponseEntity<java.lang.String>
    */
    @RequestMapping(value = "/upVideo",consumes = "multipart/form-data")
    public ResponseEntity<String> upVideo(@RequestParam("knowledge") String knowledge,@RequestParam("open")int open,@RequestParam("content")String content, @RequestBody MultipartFile file, @RequestParam("refreshToken")String refreshToken);

    /**
     * @Author: 李英勇
     * @Description: 通过vid和refreshToken判断用户是否有访问这个视频的权限
     * @DateTime: 2020/7/23 11:39
     * @Params: [vid, refreshToken]
     * @Return com.woniuxy.commons.entity.ResponseEntity<com.woniuxy.commons.entity.Vedio>
     */
    @GetMapping("/getVideoByVid/{vid}")
    public ResponseEntity<Vedio> getVideoByVid(HttpServletRequest request, @PathVariable("vid") int vid);

    /**
     * @Author: 李英勇
     * @Description: 通过vid查询视频的评论
     * @DateTime: 2020/7/23 11:39
     * @Params: [vid]
     * @Return com.woniuxy.commons.entity.ResponseEntity<java.util.List < com.woniuxy.commons.entity.VideoRemark>>
     */
    @GetMapping("/getVideoRemarkByVid/{vid}")
    public ResponseEntity<List<VideoRemark>> getVideoRemarkByVid(@PathVariable("vid") int vid, @RequestParam("page") int page, @RequestParam("limit") int limit);

    /**
     * @Author: 李英勇
     * @Description: 视频点赞
     * @DateTime: 2020/7/23 11:40
     * @Params: [vid]
     * @Return com.woniuxy.commons.entity.ResponseEntity<java.lang.String>
     */
    @PostMapping("/thumbsup")
    public ResponseEntity<Void> thumbsupVideoByVid(int vid);

    /**
     * @Author: 李英勇
     * @Description: 视频评论
     * @DateTime: 2020/7/23 11:40
     * @Params: [videoRemark, refreshToken]
     * @Return com.woniuxy.commons.entity.ResponseEntity<java.lang.String>
     */
    @PostMapping("/addRemark")
    public ResponseEntity<Void> addRemark(VideoRemark videoRemark, @RequestParam("refreshToken") String refreshToken);

    /**
     * @Author: 李英勇
     * @Description: 通过teacherid查询老师上传的视频
     * @DateTime: 2020/7/23 11:40
     * @Params: [teacherid]
     * @Return com.woniuxy.commons.entity.ResponseEntity<java.util.List < com.woniuxy.commons.entity.Vedio>>
     */
    @GetMapping("/findVideoByTeacherid")
    public ResponseEntity<List<Vedio>> findVideoByTeacherid(HttpServletRequest request, @RequestParam("page") int page, @RequestParam("limit") int limit);

    /**
     * @Author: 李英勇
     * @Description: 修改视频知识点和描述
     * @DateTime: 2020/7/23 16:34
     * @Params: [vedio]
     * @Return com.woniuxy.commons.entity.ResponseEntity<java.lang.Void>
     */
    @PostMapping("/updateVideo")
    public ResponseEntity<Void> updateVideo(Vedio vedio);

    /**
     * @Author: 李英勇
     * @Description: 通过vid删除视频
     * @DateTime: 2020/7/23 11:41
     * @Params: [vid]
     * @Return com.woniuxy.commons.entity.ResponseEntity<java.lang.String>
     */
    @PostMapping("/del")
    public ResponseEntity<Void> delVideoByVid(int vid);



}





